/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

import type.RawMaterialQuotationType;

/**
 *
 * @author thanhle
 */
@Entity(name = "RawMaterialQuotation")
public class RawMaterialQuotationEntity extends DataObjectEntity implements Serializable {

    private static final long serialVersionUID = 1L;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date validity;
    private double quantity;
    private double price;
    private double cost;

    public double getCost() {
        return cost;
    }

    public void setCost(double cost) {
        this.cost = cost;
    }
    private String note;
 

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
    private RawMaterialQuotationType Type;

    public RawMaterialQuotationType getType() {
        return Type;
    }

    public void setType(RawMaterialQuotationType Type) {
        this.Type = Type;
    }

    public double getQuantity() {
        return quantity;
    }

    public void setQuantity(double quantity) {
        this.quantity = quantity;
    }

    public RawMaterialEntity getRawMaterial() {
        return rawMaterial;
    }

    public void setRawMaterial(RawMaterialEntity rawMaterial) {
        this.rawMaterial = rawMaterial;
    }
    @OneToOne
    private RawMaterialEntity rawMaterial;
    @ManyToOne
    private SystemUserEntity systemUser;
    @ManyToOne
    private VendorEntity vendor;

    public SystemUserEntity getSystemUser() {
        return systemUser;
    }

    public void setSystemUser(SystemUserEntity systemUser) {
        this.systemUser = systemUser;
    }

    public Date getValidity() {
        return validity;
    }

    public void setValidity(Date validity) {
        this.validity = validity;
    }

    public VendorEntity getVendor() {
        return vendor;
    }

    public void setVendor(VendorEntity vendor) {
        this.vendor = vendor;
    }
//    @OneToMany(cascade = {CascadeType.PERSIST}, mappedBy = "rawMaterialQuotation")
//    private Collection<RawMaterialPurchaseOrderEntity> purchaseOrders = new ArrayList<RawMaterialPurchaseOrderEntity>();
//
//    public Collection<RawMaterialPurchaseOrderEntity> getPurchaseOrders() {
//        return purchaseOrders;
//    }
//
//    public void setPurchaseOrders(Collection<RawMaterialPurchaseOrderEntity> purchaseOrders) {
//        this.purchaseOrders = purchaseOrders;
//    }

    @Override
    public String childToString() {
        return "RawMaterialQuotationEntity{" + "validity=" + validity + ", quantity=" + quantity + ", rawMaterial=" + rawMaterial + ", systemUser=" + systemUser + ", vendor=" + vendor + '}';
    }
}
